﻿using System;
using System.Linq;
using Netkk.Common.Interfaces.Repositories;
using Netkk.Common.Interfaces.Services;
using Netkk.Common.Models;
using System.Collections.Generic;

namespace Netkk.Library.Services
{
    public class RoleService : IRoleService
    {
        private readonly IRoleRepository repository;

        public RoleService(IRoleRepository repository)
        {
            this.repository = repository;
        }

        public UserRole GetRoleById(Guid id)
        {
            IEnumerable<UserRole> roles = repository.Select();
            UserRole role = (from r in roles
                             where r.Id == id
                             select r).FirstOrDefault();
            return role;
        }
    }

}
